package com.huanying.framework.user;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Set;
import java.util.Date;
import java.util.HashSet;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.huanying.goodjob.jobtype.Jobtype;
import com.huanying.goodjob.skill.Skill;

@Entity
@Table(name="user")
public class User implements Serializable {

	/** 
	 */
	private static final long serialVersionUID = -2697936683291150264L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="id")
	private int id;//用户编号
	private String clientid;//客户端编号
	private String token;//苹果手机专用记号
	private String name;//用户名
	private String password;//密码
	private Date birthday;//出生日期（年-月-日）
	private String sex;//性别
	private String phone;//手机号
	private String address_home;//居住地址
	private String address_company;//公司地址
	private String id_card;//身份证号
	private String id_card_front_url;//身份证正面照
	private String id_card_back_url;//身份证反面照
    private String business_license_front_url;//营业执照正面照
    private String business_license_num;//营业执照号
    private String name_company;//公司名
	@Column(name="beans",nullable=false,columnDefinition="INT default 5")
    private int beans;//可用的豆数（用于接单，发单）
    private double money;//金额
    private String wechat;//微信号
	@Column(name="credit",nullable=false,columnDefinition="INT default 0")
	private int credit;//评分
    private Date create_time;//创建时间
    private int user_authenticPer; //个人认证状态：0.个人未实名认证 1.个人已实名认证  2.个人实名认证审核中
    private int user_authenticCom; //企业认证状态：0企业未实名认证 1企业已实名认证 2企业实名认证审核中
	@Column(name = "is_vip", nullable = false, columnDefinition = "INT default 0")
    private int is_vip;//会员状态：0.不是会员  1.是会员
	@Column(name="avgscore_worker",nullable=false,columnDefinition="INT default 0")
	private int avgscore_worker;//作为工人身份的平均评分
	@Column(name="avgscore_boss",nullable=false,columnDefinition="INT default 0")
	private int avgscore_boss;//作为工长身份的平均评分
	@Column(name="status",nullable=false,columnDefinition="INT default 1")
    private int status;//状态：0禁用 1可用
	private String salt;//密码加密时固定的补加字段
	private String user_authenticCom_errorIntro;//企业实名错误时描述
	private String headPortrait_url;//头像地址
	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "user_jobtype",
	joinColumns = {@JoinColumn(name = "user_id")},
	inverseJoinColumns = {@JoinColumn(name = "jobtype_id")})
    private Set<Jobtype> jobtypes= new HashSet<Jobtype>();// 对应的工种集合  
	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "user_skill",
	joinColumns = {@JoinColumn(name = "user_id")},
	inverseJoinColumns = {@JoinColumn(name = "skill_id")})
    private Set<Skill> skills= new HashSet<Skill>();// 对应的技能集合  

	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	public String getClientid() {
		return clientid;
	}
	public void setClientid(String clientid) {
		this.clientid = clientid;
	}
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	public String getAddress_home() {
		return address_home;
	}
	public void setAddress_home(String address_home) {
		this.address_home = address_home;
	}
	public String getAddress_company() {
		return address_company;
	}
	public void setAddress_company(String address_company) {
		this.address_company = address_company;
	}
	public String getId_card() {
		return id_card;
	}
	public void setId_card(String id_card) {
		this.id_card = id_card;
	}
	public String getId_card_front_url() {
		return id_card_front_url;
	}
	public void setId_card_front_url(String id_card_front_url) {
		this.id_card_front_url = id_card_front_url;
	}
	public String getId_card_back_url() {
		return id_card_back_url;
	}
	public void setId_card_back_url(String id_card_back_url) {
		this.id_card_back_url = id_card_back_url;
	}
	
	
	public String getBusiness_license_front_url() {
		return business_license_front_url;
	}
	public void setBusiness_license_front_url(String business_license_front_url) {
		this.business_license_front_url = business_license_front_url;
	}
	public String getBusiness_license_num() {
		return business_license_num;
	}
	public void setBusiness_license_num(String business_license_num) {
		this.business_license_num = business_license_num;
	}
	public String getName_company() {
		return name_company;
	}
	public void setName_company(String name_company) {
		this.name_company = name_company;
	}
	
	public int getBeans() {
		return beans;
	}
	public void setBeans(int beans) {
		this.beans = beans;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public void setMoney(double money) {
		this.money = money;
	}
	public double getMoney() {
		return money;
	}
	
	public String getWechat() {
		return wechat;
	}
	public void setWechat(String wechat) {
		this.wechat = wechat;
	}
	public int getCredit() {
		return credit;
	}
	public void setCredit(int credit) {
		this.credit = credit;
	}
	public Date getCreate_time() {
		return create_time;
	}
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	public int getUser_authenticPer() {
		return user_authenticPer;
	}
	public void setUser_authenticPer(int user_authenticPer) {
		this.user_authenticPer = user_authenticPer;
	}
	public int getUser_authenticCom() {
		return user_authenticCom;
	}
	public void setUser_authenticCom(int user_authenticCom) {
		this.user_authenticCom = user_authenticCom;
	}
	public int getIs_vip() {
		return is_vip;
	}
	public void setIs_vip(int is_vip) {
		this.is_vip = is_vip;
	}
	
	public int getAvgscore_worker() {
		return avgscore_worker;
	}
	public void setAvgscore_worker(int avgscore_worker) {
		this.avgscore_worker = avgscore_worker;
	}
	public int getAvgscore_boss() {
		return avgscore_boss;
	}
	public void setAvgscore_boss(int avgscore_boss) {
		this.avgscore_boss = avgscore_boss;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	
    public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	public Set<Jobtype> getJobtypes() {
        return jobtypes;
    }
    public void setJobtypes(Set<Jobtype> jobtypes) {
        this.jobtypes = jobtypes;
    }
	public Set<Skill> getSkills() {
		return skills;
	}
	public void setSkills(Set<Skill> skills) {
		this.skills = skills;
	}
	public String getUser_authenticCom_errorIntro() {
		return user_authenticCom_errorIntro;
	}
	public void setUser_authenticCom_errorIntro(String user_authenticCom_errorIntro) {
		this.user_authenticCom_errorIntro = user_authenticCom_errorIntro;
	}
	public String getHeadPortrait_url() {
		return headPortrait_url;
	}
	public void setHeadPortrait_url(String headPortrait_url) {
		this.headPortrait_url = headPortrait_url;
	}
	
}
